<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
  [
    '<div contenteditable>',
      '^<ruby>今日<rt>きょう</rt></ruby>',
      'は<ruby>良<rt>よ</rt></ruby>い',
      '<ruby>天気<rt>てんき</rt></ruby>ですね。',
      '<ruby><ruby>你<rt>ni</rt></ruby>',
      '<ruby>在<rt>zai</rt></ruby>',
      '<ruby>拉里<rt>zali</rt></ruby>？',
    '|</div>',
    '<textarea cols=50 rows=5></textarea>',
  ],
  selection => {
     selection.document.execCommand('copy');
     selection.document.querySelector('textarea').focus();
     selection.document.execCommand('paste');
    },
  [
    '<div contenteditable>',
      '<ruby>今日<rt>きょう</rt></ruby>',
      'は<ruby>良<rt>よ</rt></ruby>い',
      '<ruby>天気<rt>てんき</rt></ruby>ですね。',
      '<ruby><ruby>你<rt>ni</rt></ruby>',
      '<ruby>在<rt>zai</rt></ruby>',
      '<ruby>拉里<rt>zali</rt></ruby>？</ruby>',
    '</div>',
    '<textarea cols="50" rows="5">今日きょうは良よい天気てんきですね。你ni在zai拉里zali？|</textarea>',
  ],
  'This tests copying and pasting text with ruby doesnot',
  'insert new lines before and after rt.',
  'To manually test, copy and paste the text into the textarea',
  'There should be not new line in the textarea');
</script>